var t = require;
var e = module;
var o = exports;
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("Prefabs"),
    i = t("ConfS"),
    s = t("fun"),
    c = cc._decorator,
    l = c.ccclass,
    u = c.property,
    p = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (e.prefab = null), (e.time = 1), (e.y = 100), e;
        }
        var o;
        return (
            n(e, t),
            (o = e),
            (e.变化前属性 = function (t) {
                this.heroid = t;
                var e = i.DatasManager.HeroDatasById[t],
                    o = s.getHeroPars(t, s.getHeroLv(t));
                (this.a = o.attack), (this.d = o.defence), (this.h = o.hp);
                var n = s.getEquipsPars(e);
                (this.a += n.a), (this.d += n.d), (this.h += n.h), (this.z = s.getzdl(e));
            }),
            (e.变化后属性 = function (t) {
                if (this.heroid == t) {
                    var e = i.DatasManager.HeroDatasById[t],
                        o = s.getHeroPars(t, s.getHeroLv(t)),
                        n = o.attack,
                        r = o.defence,
                        c = o.hp,
                        l = s.getEquipsPars(e);
                    (n += l.a), (r += l.d), (c += l.h);
                    var u = s.getzdl(e);
                    (this.list = {}),
                        n > this.a && (this.list["攻击力"] = n - this.a),
                        r > this.d && (this.list["防御力"] = r - this.d),
                        c > this.h && (this.list["生命值"] = c - this.h),
                        u > this.z && (this.list["战斗力"] = u - this.z),
                        Object.keys(this.list).length > 0 &&
                            cc.Canvas.instance.node.addChild(a.instantiate("仓库属性战斗力变化飘字"));
                }
            }),
            (e.prototype.onEnable = function () {
                var t = this.prefab,
                    e = o.list;
                for (var n in e) {
                    var r = e[n];
                    t || ((t = cc.instantiate(this.prefab)).parent = this.node),
                        (t.getComponent(cc.Label).string = n + ": +" + r),
                        (t = null);
                }
            }),
            (e.prototype.start = function () {
                var t = this;
                cc.tween(this.node)
                    .by(this.time, {y: this.y})
                    .call(function () {
                        t.node.destroy();
                    })
                    .start();
            }),
            r([u(cc.Node)], e.prototype, "prefab", void 0),
            r([u], e.prototype, "time", void 0),
            r([u], e.prototype, "y", void 0),
            (e = o = r([l], e))
        );
    })(cc.Component);
o.default = p;
